#include <iostream>
#include <unistd.h>
#include <sys/types.h>
#include <signal.h>
using namespace std;
void handle(int signo)
{
    cout<<"signal:"<<signo<<endl;
    int n=alarm(0);
    cout<<"n="<<n<<endl;
}
int main()
{
    cout<<getpid()<<endl;
    //signal(SIGALRM,handle);
    int count=0;
    cout<<"alarm's return"<<alarm(5)<<endl;
    alarm(0);
    while (true)
    {
        cout<<"循环中:"<<count++<<endl;
        sleep(1);
    }

    return 0;
}